{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Ch `03`: Concept `01`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Linear regression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Import TensorFlow for the learning algorithm. We'll need NumPy to set up the initial data. And we'll use matplotlib to visualize our data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define some constants used by the learning algorithm. There are called hyper-parameters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "learning_rate = 0.01\n",
    "training_epochs = 100"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Set up fake data that we will use to to find a best fit line"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "x_train = np.linspace(-1, 1, 101)\n",
    "y_train = 2 * x_train + np.random.randn(*x_train.shape) * 0.33"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Plot the raw data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f12c005b8d0>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHotJREFUeJzt3XuQnOV15/HvGZjLa41npIknGK+JBoNtlMQOM9TExKaW\nFpa8xJWUKPBGO1W7a6OpgIwTp8iur6SCWLALu5IisROVxK7s2C7rEuwsmNgYpKAORWzcKkkgvJK4\nGM3gGMJ0NiBqzFxY69k/unvUPdOX99a3t3+fqi5mRu+8FxpOPzrPec5jzjlERCRZupp9AyIiEj8F\ndxGRBFJwFxFJIAV3EZEEUnAXEUkgBXcRkQQ6N+oJzKwXeAToyZ/vW86526KeV0REwrM46tzN7A3O\nudfM7Bzgn4CPO+cykU8sIiKhxJKWcc69lv+yl9zoXSujRESaKJbgbmZdZnYU+Bdgv3PuUBznFRGR\ncOIauZ9xzo0CbwXeY2a/Gsd5RUQknMgTqsWcc6+a2UHgauB48Z+ZmVI1IiIhOOcs6O9EHrmb2ZvM\nbDD/tQdsBE6WO9Y5l9jXrbfe2vR70PPp2fR8yXuFFcfI/Xzga2bWRe7DYp9z7nsxnFdEREKKHNyd\nc08CYzHci4iIxEQrVGOSSqWafQt1leTnS/KzgZ6vU8WyiMnXhcxco64lIpIUZoZrxoSqiIi0HgV3\nEZEEUnAXEUkgBXcRkQRScBcRSSAFdxGRBFJwFxFJIAV3EZEEUnAXEUkgBXcRaQnZbJZDhw6RzWab\nfSuJoOAuIk23Z88+1q69hI0bt7J27SXs2bOv2bfU9tRbRkSaKpvNsnbtJczNHQTeDRzD89YzPX2S\n4eHhZt9e06m3jIi0pampKXp6RsgFdoB30929lqmpqebdVAIouItIU42MjLC4OAUcy//kGK+/Ps3I\nyEjzbioBFNxFpKmGh4fZtWs7nreegYExPG89u3ZtV0omIuXcRaQlZLNZpqamGBkZUWAvEjbnruAu\nItLCNKEqIiJLFNxFRBJIwV1EJIEU3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IpuIuIJJCCu4hIAim4i4gk0P8HpLSB2bLWtlIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f13140335c0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x_train, y_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Set up the input and output nodes as placeholders since the value will be injected by `x_train` and `y_train`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "X = tf.placeholder(\"float\")\n",
    "Y = tf.placeholder(\"float\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define the model as `y = w'*x`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "def model(X, w):\n",
    "    return tf.multiply(X, w)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Set up the weights variable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "w = tf.Variable(0.0, name=\"weights\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define the cost function as the mean squared error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "y_model = model(X, w)\n",
    "cost = tf.reduce_mean(tf.square(Y-y_model))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define the operation that will be called on each iteration of the learning algorithm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "train_op = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Initialize all variables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "sess = tf.Session()\n",
    "init = tf.global_variables_initializer()\n",
    "sess.run(init)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Train on each (x, y) pair multiple times"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "for epoch in range(training_epochs):\n",
    "    for (x, y) in zip(x_train, y_train):\n",
    "        sess.run(train_op, feed_dict={X: x, Y: y})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Fetch the value of the learned parameter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "w_val = sess.run(w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "sess.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Visualize the best fit curve"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCS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3RNtSIYb7gzjfu2wIqgYs\ndM4tc879KNONSbF/Av4e9P1H/p/lgoPMbDuAmW0DDgpzXJFzrt4594ZzLps/uGJ5L1qOMbP9wBfO\nub4d07ykxfpv7Rz/sMXjzrlDO6ZpHaLt/X9M7vxfi9WJ/uHPPznnjo52cLKpkC8BwZ+ODl+wvsXM\nno3xNKeY2VbnXBnwknNunf9TLONSdH9ZK8L9hRrPCzfzXu5//w4HXnHOrTGzD1Pc1EzJyV5uBM8A\n88xsr3Pux/h+S8ml3046s+X4/q995Zw7C3gaX6ZiWEkFdzMbk8zr/efY6v/T65z7A75fL7MiuKfg\n/j4GgiflDvX/LCtEuj//5E5/M9vur/bZEOYcgffvQ+dcHVAJZGNwj+W9+Ag4DNjinOsKlJrZZx3U\nvmRFvT8zC/61/7fAXR3Qro7yMb73LiCr/q8ly4LqeJnZC865Gc65vpH+fXbUsEzIHpBzrrtzrsT/\ndQ/gDOBvHdSmVArXw1sGHOmcK3fOFQLfx9d7ygXPABf7v74I+GPbA5xzvf33hXOuH3AysLajGhin\nWN6LZ/HdK8D5+CbLc0XU+2tTkvtssve9CscR/v/aM/hqXOGcOxH4IjCsmEPC3l/w/IFz7nh8aeyR\nOx5pnP0di28MrBHYCrzg//kA4Dn/14fjm9VfCbwN3JTpWetU3p//+zOBd4D3cuz++gKL/W1fBPT2\n/3w48ID/65OANf73bzVwcabbHeWe2r0XwFTgu/6vi4DH/c8vBSoy3eYU398v8HWeVgIvA4My3eY4\n7m0esAVoAjYDlwCXAj8OOubX+DKGVhMhQy8bH9HuD7gi6L17Azgh2jm1iElEJA9lQ7aMiIikmIK7\niEgeUnAXEclDCu4iInlIwV1EJA8puIuI5CEFdxGRPKTgLiKSh/4/r+ZQwAz/vsQAAAAASUVORK5C\nYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f12bff21b00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x_train, y_train)\n",
    "y_learned = x_train*w_val\n",
    "plt.plot(x_train, y_learned, 'r')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
